package com.zhny.aiot.hb.water.level.plugin;

import com.zhny.aiot.hb.water.level.plugin.model.WaterStoreEntry;
import com.zhny.aiot.plugin.ICenterFacilities;
import com.zhny.aiot.plugin.IDevice;
import com.zhny.aiot.plugin.modbus.ModemServer;
import com.zhny.aiot.plugin.modbus.device.ModemConfig;
import com.zhny.aiot.plugin.modbus.device.ModemDeviceFactory;
import com.zhny.aiot.plugin.modbus.handler.model.ModemRequestMessage;
import com.zhny.aiot.plugin.model.CommandEntry;
import com.zhny.aiot.plugin.model.DeviceEntity;
import com.zhny.aiot.plugin.model.FactoryType;
import com.zhny.aiot.plugin.model.StoreEntity;
import org.pf4j.Extension;
import org.pf4j.Plugin;
import org.pf4j.PluginWrapper;
public class WaterLevelPlugin extends Plugin {
    public WaterLevelPlugin(PluginWrapper wrapper) {
        super (wrapper);
    }
    @Extension
    public static class FertilizerFactory extends ModemDeviceFactory<WaterStoreEntry> {
        @Override
        public ModemRequestMessage getRequestMessage(ModemConfig modemConfig) {
            return new ModemRequestMessage (Integer.parseInt (modemConfig.getAddress ()),(short) 3,0x0004,1);
        }

        @Override
        public IDevice createDevice(ICenterFacilities iCenterFacilities, DeviceEntity entity) {
            return new WaterLevelDevice (ModemServer.getInstance ().getEngine () ,this,iCenterFacilities,entity);
        }
        @Override
        public Class<? extends StoreEntity> storeClass() {
            return WaterStoreEntry.class;
        }

        @Override
        public String getId() {
            return "hb-water-level-plugin";
        }

        @Override
        public String getName() {
            return "淮北数显液位计";
        }

        @Override
        public FactoryType getType() {
            return FactoryType.Integrate;
        }
    }
}
